package com.yami.shop.mystery.common.listener;

import cn.hutool.core.bean.BeanUtil;
import com.yami.shop.bean.event.QualificationEvent;
import com.yami.shop.mystery.common.model.ActivityPresellQualification;
import com.yami.shop.mystery.common.service.ActivityPresellQualificationServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

@Component
public class AddQualificationListener {

    @Autowired
    private ActivityPresellQualificationServer activityPresellQualificationServer;

    @EventListener(QualificationEvent.class)
    public void apply(QualificationEvent event) {
        ActivityPresellQualification activityPresellQualification = new ActivityPresellQualification();
        BeanUtil.copyProperties(event,activityPresellQualification);
        activityPresellQualificationServer.save(activityPresellQualification);
    }

}
